<template>
  <div class="courseSchedulingContainer">
    <el-dialog
      v-if="isShow"
      :visible.sync="isShow"
      custom-class="el-dialog-bg"
      :close-on-click-modal="modalclose"
      :before-close="handleClose"
    >
      <div slot="title" class="panel_title">
        <span>排课</span>
      </div>
      <div class="coursescheduling">
        <div class="dialog">
          <div class="editorcourse" v-if="classinfo">
            <div class="item">
              <span class="spanlabelweight">{{classinfo.className}}</span>
              <span class="spanlabelweight">({{classinfo.classNo}})</span>
              <span
                class="spanlabel"
                style="cursor: pointer;color: blue;"
                @click="classDetail(classinfo.classId)"
              >信息详情</span>
            </div>
            <div class="item">
              <span class="spanlabel">课程进度：</span>
              <span
                class="spanlabelweight"
              >{{classinfo.useCourseHour||0}}/{{classinfo.courseDateCount||0}}</span>
            </div>
            <div class="item" style="height: 0.5rem;">
              <span class="spanlabel">排课时间：</span>

              <el-date-picker
                v-model="classinfo_pickerOptionsTime"
                type="datetimerange"
                range-separator="-"
                :start-placeholder="classinfo.startTime"
                :end-placeholder="classinfo.endTime"
                :picker-options="classinfo_pickerOptions"
              ></el-date-picker>
            </div>
            <div class="item">
              <span class="spanlabel">每周上课次数：</span>
              <span>
                <el-input
                  style="width:1rem;"
                  ref="coursenum"
                  @change="changenum"
                  v-model="coursenum"
                  placeholder="请输入内容"
                ></el-input>
              </span>
            </div>
            <div class="coursearrange">
              <div class="plan" v-for="item in courselist">
                <span class="spanlabel" style="float: left;">
                  每周第
                  <span class="spanlabelweight">{{item.index}}</span>次课
                </span>
                <template>
                  <el-select
                    @change="selectWeek"
                    ref="selectWeek"
                    style="float:left;width:1rem;margin-left: 0.1rem;"
                    v-model="item.week"
                    placeholder="星期"
                  >
                    <el-option v-for="i in weeks" :key="i.value" :label="i.name" :value="i.value"></el-option>
                  </el-select>
                </template>
                <template>
                  <el-time-select
                    ref="selectStartTime"
                    class="coursearrange_timeselect"
                    style="margin-left: .1rem;"
                    @change="selectStartTime"
                    placeholder="起始时间"
                    v-model="item.datetime_start"
                    :picker-options="{
                            start: '08:00',
                            step: '00:30',
                            end: '21:00'
                          }"
                  ></el-time-select>

                  <span style="float:left;margin-left: .03rem;margin-right: .03rem;">至</span>

                  <el-time-select
                    ref="selectEndTime"
                    class="coursearrange_timeselect"
                    @change="selectEndTime"
                    placeholder="结束时间"
                    v-model="item.datetime_end"
                    :picker-options="{
                            start: '08:00',
                            step: '00:30',
                            end: '21:00'
                          }"
                  ></el-time-select>
                </template>
                <el-input
                  style="width:.5rem;float: left;margin-left: .1rem;"
                  ref="changeCoursehour"
                  @change="changeCoursehour"
                  v-model="item.coursetime"
                ></el-input>
                <span style="float: left;">课时</span>
                <el-select
                  style="width:1.1rem;float: left;margin-left: .1rem;"
                  filterable
                  ref="selectTeacher"
                  @change="selectTeacher"
                  v-model="item.teacher"
                  placeholder="教师"
                >
                  <el-option
                    v-for="ite in Teacherlist"
                    :key="ite.userId"
                    :label="ite.nickName"
                    :value="ite.userId"
                  ></el-option>
                </el-select>
                <el-select
                  style="width:1.1rem;float: left;margin-left: .1rem;"
                  filterable
                  ref="selectAssist"
                  @change="selectAssist"
                  v-model="item.assistant"
                  placeholder="助教"
                >
                  <el-option
                    v-for="ite in Teacherlist"
                    :key="ite.userId"
                    :label="ite.nickName"
                    :value="ite.userId"
                  ></el-option>
                </el-select>
                <el-select
                  style="width:1.1rem;float: left;margin-left: .1rem;"
                  filterable
                  ref="selectClassroom"
                  @change="selectClassroom"
                  v-model="item.classroom"
                  placeholder="教室"
                >
                  <el-option
                    v-for="ite in Classroomlist"
                    :key="ite.classroomId"
                    :label="ite.name"
                    :value="ite.classroomId"
                  ></el-option>
                </el-select>
              </div>
            </div>
            <div class="btnbox">
              <el-button @click="arrangeCancel" class="btnCancel">取 消</el-button>

              <el-button @click="checkarrangeOk" v-if="courselist.length>0" class="btnOk">排课</el-button>
              <el-button @click="checkarrangeOk" disabled v-else class="btnOk">排课</el-button>
            </div>
          </div>
          <div class="courseconflictlist" v-if="conflictpanel">
            <div class="line"></div>

            <div class="conflictdescribe">
              <span class="spanlabel">提醒：</span>
              <span class="spanlabelweight" v-html="conflictdescrib"></span>
            </div>
            <div class="conflictlist">
            				<div class="tablecss">
			              		<table style="width:100%;" cellpadding="0" cellspacing="0">
							      			<thead>
							      				<tr>
							      					<th>课程序号</th>
							      					<th style="width:2rem;">上课时间</th>
							      					<th>课程名称</th>						    					
							      					<th>教师</th>
							      					<th>教室</th>
							      					<th>状态</th>					      					
							      				</tr>
							      			</thead>
							      			<tbody  v-if="conflictcourse.length>0">
							      				<tr v-for="li in conflictcourse">
							      					<td align="center">{{li.orderBy}}</td>
							      					<td align="center">
							      							<span>{{li.startTime.split(' ')[0]}}</span>
				                      		<span>{{li.startTime.split(' ')[1]}}-{{li.endTime.split(' ')[1]}}</span>
							      					</td>
							      					<td align="center">{{li.courseName}}</td>
							      					<td align="center">
							      						 <span v-if="li.conflictType==1" style="color:red;">{{li.teacherUserName}}</span>
			                           <span v-else>{{li.teacherUserName}}</span>
							      					</td>
							      					<td align="center">
							      						<span v-if="li.conflictType==2" style="color:red;">{{li.classroomName}}</span>
			                      		<span v-else>{{li.classroomName}}</span>
							      					</td>
							      					<td align="center">
							      						<span v-if="li.attendMode==1">待开课</span>
					                      <span v-else-if="li.attendMode==2">上课中</span>
					                      <span v-else-if="li.attendMode==3">已结课</span>
					                      <span v-else-if="li.attendMode==4">提前结课</span>
							      					</td>							      										      										      										      					
							      				</tr>		      				
							      			</tbody>
							      			<tbody  v-else >
							      				<tr>
							      					<td colspan="11" align="center">暂无数据</td>
							      				</tr>
							      			</tbody>
				      		    </table>
				      		</div>
		              <!--<template>
		                <el-table :data="conflictcourse" max-height="200" style="width: 100%">
		                  <el-table-column prop="orderBy" label="课程序号" align="center" width="100">
		                    <template slot-scope="scope">
		                      <span>{{scope.row.orderBy}}次</span>
		                    </template>
		                  </el-table-column>
		                  <el-table-column prop="startTime" label="上课时间" align="center" width="220">
		                    <template slot-scope="scope">
		                      <span>{{scope.row.startTime.split(' ')[0]}}</span>
		                      <span>{{scope.row.startTime.split(' ')[1]}}-{{scope.row.endTime.split(' ')[1]}}</span>
		                    </template>
		                  </el-table-column>
		                  <el-table-column prop="courseName" label="课程名称" align="center"></el-table-column>
		                  <el-table-column prop="teacherUserName" label="教师" align="center">
		                    <template slot-scope="scope">
		                      <span
		                        v-if="scope.row.conflictType==1"
		                        style="color: red;"
		                      >{{scope.row.teacherUserName}}</span>
		                      <span v-else>{{scope.row.teacherUserName}}</span>
		                    </template>
		                  </el-table-column>
		                  <el-table-column prop="classroomName" label="教室" align="center">
		                    <template slot-scope="scope">
		                      <span
		                        v-if="scope.row.conflictType==2"
		                        style="color: red;"
		                      >{{scope.row.classroomName}}</span>
		                      <span v-else>{{scope.row.classroomName}}</span>
		                    </template>
		                  </el-table-column>
		                  <el-table-column prop="attendMode" label="状态" align="center">
		                    <template slot-scope="scope">
		                      <span v-if="scope.row.attendMode==1">待开课</span>
		                      <span v-else-if="scope.row.attendMode==2">上课中</span>
		                      <span v-else-if="scope.row.attendMode==3">已结课</span>
		                      <span v-else-if="scope.row.attendMode==4">提前结课</span>
		                    </template>
		                  </el-table-column>
		                </el-table>
		              </template>-->
            </div>
            <div class="btnbox">
              <el-button @click="btnCancel" class="btnCancel">取 消</el-button>
              <el-button @click="btnOk" class="btnOk">确定排课</el-button>
            </div>
          </div>
        </div>
      </div>
    </el-dialog>
    <!--回到首页弹框-->
    <el-dialog
      title
      custom-class="el-dialog-bg2"
      :close-on-click-modal="modalclose"
      :visible.sync="backVisible"
      :before-close="handleClose2"
    >
      <div class="backindex">
        <div class="successImg"></div>
        <div class="success">您已成功排课</div>
        <div class="btn">
          <el-button @click="backIndex" class="btnCancel">回班级管理首页</el-button>
          <el-button @click="SeeTimetable" class="btnOk">查看排课课表</el-button>
        </div>
      </div>
    </el-dialog>

    <!--加载面板-->
   <!-- <loading ref="loading"></loading>-->
    <!--班级详情-->
   <!-- <classdetail></classdetail>-->
  </div>
</template>

<script>
import { mapState, mapGetters, mapActions } from "vuex"; //先要引入
//import classdetail from "./classdetail";
//import loading from "../../common/loading";
let vm;
export default {
//components: { classdetail, loading },
  props: ["classinfo"],
  data() {
    return {
      modalclose: false,
      loadingObj: null,
      backVisible: false,
      datetimer: "",
      conflictpanel: false,
      coursenum: 0,
      conflictdescrib: "",
      courselist: [],
      conflictcourse: [],
      weeks: [
        { name: "星期一", value: 1 },
        { name: "星期二", value: 2 },
        { name: "星期三", value: 3 },
        { name: "星期四", value: 4 },
        { name: "星期五", value: 5 },
        { name: "星期六", value: 6 },
        { name: "星期日", value: 0 }
      ],
      classinfo_pickerOptions: {},
      classinfo_pickerOptionsTime: []
    };
  },
  methods: {
    initDialog() {
      this.coursenum = 0;
      this.courselist = [];
      this.conflictpanel = false;
      this.conflictcourse = [];
    },
    resetPickerOptionTime() {
      this.classinfo_pickerOptionsTime = [];
    },
    /**字符串形如：2019-02-01 10:20 */
    getDateByTimeStr(str) {
      let timestrarray = str.split(" ");
      let hourarray = timestrarray[1].split(":");
      let daystr = timestrarray[0].replace("-", "/");
      let time = new Date(daystr);
      time.setHours(Number(hourarray[0]));
      time.setMinutes(Number(hourarray[0]));
      time.setSeconds(0);

      return time;
    },
    /**返回字符串：2019-02-02 */
    getTimeStrByDate(time) {
      return (
        time.getFullYear() + "-" + (time.getMonth() + 1) + "-" + time.getDate()
      );
    },
    handleClose() {
      //console.log(this.Teacherlist)
      this.initDialog();
      this.$store.dispatch("courseScheduling/hidecourseSchedulingPanel");
    },
    handleClose2(done) {
      this.initDialog();
      done();
    },
    btnCancel() {
      this.initDialog();
      this.$store.dispatch("courseScheduling/hidecourseSchedulingPanel");
    },
    /**
     * 确定排课
     */
    btnOk() {
      let syllabusList = {};

      syllabusList["classId"] = this.classinfo.classId;
      syllabusList["classStartTime"] = this.classinfo.startTime.split(" ")[0];
      syllabusList["classEndTime"] = this.classinfo.endTime.split(" ")[0];
      if (
        this.classinfo_pickerOptionsTime &&
        this.classinfo_pickerOptionsTime.length == 2
      ) {
        syllabusList["classStartTime"] = this.getTimeStrByDate(
          this.classinfo_pickerOptionsTime[0]
        );
        syllabusList["classEndTime"] = this.getTimeStrByDate(
          this.classinfo_pickerOptionsTime[1]
        );
      }
      syllabusList["WeekCourseCount"] = this.courselist.length;
      syllabusList["coursePackageId"] = this.classinfo.coursePackageId;
      syllabusList["classSyllabusWeekFormEntityList"] = [];
      for (let i = 0; i < this.courselist.length; i++) {
        let row = this.courselist[i];

        syllabusList["classSyllabusWeekFormEntityList"].push({
          weekMode: row.week,
          startTime: row.datetime_start,
          endTime: row.datetime_end,
          courseHour: row.coursetime,
          teacherUserId: row.teacher,
          assisUserId: row.assistant,
          classroomId: row.classroom,
          attendMode: this.classinfo.classStatusMode
        });
      }

      //	this.loadingObj.initLoading("正在排课...");
      api
        .coursescheduling(syllabusList)
        .then(function(data) {
          if (data.result == "操作成功") {
            vm.conflictpanel = true;
            vm.backVisible = true;
            vm.initDialog();
            vm.$store.dispatch("courseScheduling/hidecourseSchedulingPanel");
            vm.$parent.initData();
            //	vm.loadingObj.closeLoading();
          }
        })
        .catch(function(data) {
          //	vm.loadingObj.closeLoading();
        });
    },

    /**
     * 选择教师
     */
    selectTeacher(val) {
      for (let i = 0; i < this.courselist.length; i++) {
        if (this.courselist[i].teacher == "") {
          this.courselist[i].teacher = val;
        }
      }
    },

    /**
     * 选择助教
     */
    selectAssist(val) {
      for (let i = 0; i < this.courselist.length; i++) {
        if (this.courselist[i].assistant == "") {
          this.courselist[i].assistant = val;
        }
      }
    },
    /**
     * 选择教师
     */
    selectClassroom(val) {
      for (let i = 0; i < this.courselist.length; i++) {
        if (this.courselist[i].classroom == "") {
          this.courselist[i].classroom = val;
        }
      }
    },
    /**
     * 课时
     */
    changeCoursehour(val) {
      for (let i = 0; i < this.courselist.length; i++) {
        if (this.courselist[i].coursetime == "") {
          this.courselist[i].coursetime = val;
        }
      }
    },
    /**
     * 选择周几
     */
    selectWeek(val) {
      for (let i = 0; i < this.courselist.length; i++) {
        if (this.courselist[i].week == "") {
          this.courselist[i].week = val;
        }
      }
    },
    /**
     * 选择开始时间
     */
    selectStartTime(val) {
      for (let i = 0; i < this.courselist.length; i++) {
        if (this.courselist[i].datetime_start == "") {
          this.courselist[i].datetime_start = val;
        }
      }
    },
    /**
     * 选择结束时间
     */
    selectEndTime(val) {
      for (let i = 0; i < this.courselist.length; i++) {
        if (this.courselist[i].datetime_end == "") {
          this.courselist[i].datetime_end = val;
        }
      }
    },
    /**
     * 班级详情
     */
    classDetail(classId) {
      this.$store.dispatch("classdetail/getClassInfo", { classId: classId }); //获取进班班级信息
    },
    /**
     * 回班级管理首页
     */
    backIndex() {
      this.backVisible = false;
      this.$store.dispatch("courseScheduling/hidecourseSchedulingPanel");
      router.push("/education_manage/class_manage");
    },
    /**
     * 查看课表
     */
    SeeTimetable() {
      let paras = {
        classId: this.classinfo.classId,
        courseId: this.classinfo.coursePackageId
      };
      this.$store.dispatch("timetableList/gettimetableList", paras);
      this.$store.dispatch("courseScheduling/hidecourseSchedulingPanel");
      this.backVisible = false;
    },

    /**
     * 每周课次改变
     */
    changenum(val) {
      let coursenum = this.$refs.coursenum;

      let flag = /^([0-9]?|10)$/.test(val);
      if (!flag) {
        this.$message({
          showClose: true,
          message: "每周排课只能1-10次课",
          type: "warning"
        });
        coursenum.focus();
        return;
      }

      this.courselist = [];
      for (let i = 0; i < val; i++) {
        this.courselist.push({
          index: i + 1,
          datetime_start: "",
          datetime_end: "",
          coursetime: this.classinfo.oneCourseHour,
          teacher:
            this.classinfo.teacherUserId == 0
              ? ""
              : this.classinfo.teacherUserId || "",
          assistant:
            this.classinfo.assisUserId == 0
              ? ""
              : this.classinfo.assisUserId || "",
          classroom:
            this.classinfo.classRoomId == 0
              ? ""
              : this.classinfo.classRoomId || "",
          week: ""
        });
      }
    },
    /**
     * 检查排课冲突
     */
    checkarrangeOk() {
    
      //验证
      if (this.courselist.length <= 0) {
        this.$message({
          message: "上课次数不能小于0",
          type: "warning"
        });
        return;
      }
      let coursenum = this.$refs.coursenum;

      let selectWeeks = this.$refs.selectWeek; //选择周
      let selectStartTimes = this.$refs.selectStartTime; //开始时间
      let selectEndTimes = this.$refs.selectEndTime; //结束时间
      let changeCoursehours = this.$refs.changeCoursehour; //课时
      let selectTeachers = this.$refs.selectTeacher; //教师
      let selectAssists = this.$refs.selectAssist; //助教
      let selectClassrooms = this.$refs.selectClassroom; //教室
      let rules = [];
      if (coursenum.value > 10) {
        rules.push({
          judge: null,
          focus: coursenum,
          tips: "每周排课只能1-10次课"
        });
      }
      //验证周
      for (let i = 0; i < selectWeeks.length; i++) {
        rules.push({
          judge: tool.judge("empty", selectWeeks[i].value),
          focus: selectWeeks[i],
          tips: "请选择星期"
        });
      }
      //验证开始时间
      for (let i = 0; i < selectStartTimes.length; i++) {
        rules.push({
          judge: tool.judge("empty", selectStartTimes[i].value),
          focus: selectStartTimes[i],
          tips: "请选择开始时间"
        });
      }
      //验证结束时间
      for (let i = 0; i < selectEndTimes.length; i++) {
        rules.push({
          judge: tool.judge("empty", selectEndTimes[i].value),
          focus: selectEndTimes[i],
          tips: "请选择结束时间"
        });
      }
      //验证课时
      for (let i = 0; i < changeCoursehours.length; i++) {
        rules.push({
          judge: tool.judge("integer", changeCoursehours[i].value),
          focus: changeCoursehours[i],
          tips: "请输入正整数"
        });
      }
      //验证教师
      for (let i = 0; i < selectTeachers.length; i++) {
        rules.push({
          judge: tool.judge("empty", selectTeachers[i].value),
          focus: selectTeachers[i],
          tips: "请选择教师"
        });
      }
      //验证助教
//    for (let i = 0; i < selectAssists.length; i++) {
//      rules.push({
//        judge: tool.judge("empty", selectAssists[i].value),
//        focus: selectAssists[i],
//        tips: "请选择助教"
//      });
//    }

      //验证教室
      for (let i = 0; i < selectClassrooms.length; i++) {
        rules.push({
          judge: tool.judge("empty", selectClassrooms[i].value),
          focus: selectClassrooms[i],
          tips: "请选择教室"
        });
      }

      if (!tool.validate(rules)) {
        return;
      }
      //验证同一课程开始结束时间
      for (let i = 0; i < this.courselist.length; i++) {
        let rowi = this.courselist[i];
        if (rowi.datetime_start == rowi.datetime_end) {
          this.$message({
            message: "输入的课程开始、结束时间不能相同！",
            type: "warning"
          });
          return;
        }
      }
      //验证不同课程时间是否冲突
      let conflict = false;
      for (let i = 0; i < this.courselist.length; i++) {
        let rowi = this.courselist[i];
        if (conflict) break;
        for (let j = i + 1; j < this.courselist.length; j++) {
          let rowj = this.courselist[j];
          if (rowi.week == rowj.week) {
            let starti = rowi.datetime_start.split(":"),
              endi = rowi.datetime_end.split(":"),
              startj = rowj.datetime_start.split(":"),
              endj = rowj.datetime_end.split(":");
            let sti = starti[0] + starti[1] / 60;
            let edi = endi[0] + endi[1] / 60;
            let stj = startj[0] + startj[1] / 60;
            let edj = endj[0] + endj[1] / 60;
            if ((sti <= stj && edi > stj) || (sti > stj && sti < edj)) {
              conflict = true;
              break;
            }
          }
        }
      }
      if (conflict) {
        this.$message({
          message: "输入的排课时间存在冲突，请检查后重试！",
          type: "warning"
        });
        return;
      }

      let syllabusList = {};

      syllabusList["classId"] = this.classinfo.classId;
      syllabusList["classStartTime"] = this.classinfo.startTime.split(" ")[0];
      syllabusList["classEndTime"] = this.classinfo.endTime.split(" ")[0];
      if (
        this.classinfo_pickerOptionsTime &&
        this.classinfo_pickerOptionsTime.length == 2
      ) {
        syllabusList["classStartTime"] = this.getTimeStrByDate(
          this.classinfo_pickerOptionsTime[0]
        );
        syllabusList["classEndTime"] = this.getTimeStrByDate(
          this.classinfo_pickerOptionsTime[1]
        );
      }
      syllabusList["WeekCourseCount"] = this.courselist.length;
      syllabusList["coursePackageId"] = this.classinfo.coursePackageId;
      syllabusList["classSyllabusWeekFormEntityList"] = [];

      for (let i = 0; i < this.courselist.length; i++) {
        let row = this.courselist[i];

        syllabusList["classSyllabusWeekFormEntityList"].push({
          weekMode: row.week,
          startTime: row.datetime_start,
          endTime: row.datetime_end,
          courseHour: row.coursetime,
          teacherUserId: row.teacher,
          assisUserId: row.assistant,
          classroomId: row.classroom,
          attendMode: this.classinfo.classStatusMode
        });
      }
      console.log(syllabusList);
      //	this.loadingObj.initLoading("正在检查排课是否冲突...");
      api
        .checkCourse(syllabusList)
        .then(function(data) {
          if (data.result == "排课有冲突") {
            vm.conflictcourse = data.syllabusList;
            vm.conflictpanel = true;
            let tempteacher = "";
            let tempclassroom = "";

            for (let i = 0; i < vm.conflictcourse.length; i++) {
              if (vm.conflictcourse[i].conflictType == 1) {
                tempteacher += vm.conflictcourse[i].orderBy + "\\";
              } else if (vm.conflictcourse[i].conflictType == 2) {
                tempclassroom += vm.conflictcourse[i].orderBy + "\\";
              }
            }
            if (tempteacher != "") {
              let teacherindex = tempteacher.lastIndexOf("\\");
              if (teacherindex > 0)
                tempteacher = tempteacher.substring(0, teacherindex);
              tempteacher =
                "第" + tempteacher + "次课教师有上课时间冲突" + "。&nbsp;";
            }
            if (tempclassroom != "") {
              let classindex = tempclassroom.lastIndexOf("\\");
              if (classindex > 0)
                tempclassroom = tempclassroom.substring(0, classindex);
              tempclassroom = "第" + tempclassroom + "次课教室有上课时间冲突";
            }
            vm.conflictdescrib = tempteacher + tempclassroom;
          } else {
            vm.conflictcourse = data.syllabusList||[];
            vm.conflictpanel = true;
            vm.conflictdescrib = "无课程冲突";
          }
          //	vm.loadingObj.closeLoading();
        })
        .catch(function(data) {
          //		vm.loadingObj.closeLoading();
        });
    },
    /**
     * 排课取消
     */
    arrangeCancel() {
      this.initDialog();
      this.$store.dispatch("courseScheduling/hidecourseSchedulingPanel");
    }
  },
  computed: {
    ...mapState({
      isShow: state => state.courseScheduling.courseSchedulingDialog,
      Teacherlist: state => state.commondata.teacherlist,
      Classroomlist: state => state.commondata.classroomlist
    })
  },
  mounted() {
    this.initDialog();
    //    this.loadingObj = this.$refs.loading;
    vm = this;
  },
  created: function() {
    this.classinfo_pickerOptions.disabledDate = function(d) {
      let startTime = vm.getDateByTimeStr(vm.classinfo.startTime + " 00:00");
      let endTime = vm.getDateByTimeStr(vm.classinfo.endTime + " 00:00");

      if (
        vm.classinfo_pickerOptionsTime &&
        vm.classinfo_pickerOptionsTime.length == 2
      ) {
        startTime = vm.classinfo_pickerOptionsTime[0];
        endTime = vm.classinfo_pickerOptionsTime[1];
      }
      if (d < startTime || d > endTime) {
        return true;
      }
      return false;
    };
  }
};
</script>

<style lang="scss">
@import "@/style/module/utils.scss";
.courseSchedulingContainer {
  .coursescheduling {
    width: 100%;
    padding: 0 0.31rem 0.3rem 0.31rem;
    .editorcourse {
      width: 100%;
     /* max-height: 5rem;*/
      .item {
        width: 100%;
        height: 0.3rem;
        line-height: 0.3rem;
      }
      .coursearrange {
        width: 100%;
      /*  max-height: 2rem;*/
        margin-top: 0.2rem;
        overflow: auto;
        .plan {
          width: 100%;
          height: 0.5rem;
          line-height: 0.4rem;
        }
        .coursearrange_timeselect {
          float: left;
          width: 1.2rem;
          .el-input__inner {
            font-size: 0.14rem;
          }
          .el-range-separator {
            width: 8%;
          }
        }
      }
      .btnbox {
        width: 100%;
        height: 0.5rem;
        margin-top: 0.2rem;
        text-align: center;
        line-height: 0.5rem;
        .btnOk {
          width: 1.6rem;
          height: 0.4rem;
          font-size: 0.16rem;
          background: #3885f8;
          color: #ffffff;
          border-radius: 0.1rem;
        }
        .btnCancel {
          width: 1.6rem;
          height: 0.4rem;
          font-size: 0.16rem;
          background: #ffffff;
          color: #333333;
          border-radius: 0.1rem;
        }
      }
    }
    .courseconflictlist {
      width: 100%;      
      padding: 0.2rem;
      .conflictdescribe {
        width: inherit;
        max-height: 1.5rem;
      }
      .line {
        width: 100%;
        height: 1px;
        background: #dedede;
        margin-bottom: 0.2rem;
      }
      .conflictlist {
        width: 100%;    
        margin-top: 0.1rem;   
      }
      .btnbox {
        width: 100%;
        height: 0.5rem;
        margin-top: 0.2rem;
        text-align: center;
        line-height: 0.5rem;
        .btnOk {
          width: 1.6rem;
          height: 0.4rem;
          font-size: 0.16rem;
          background: #3885f8;
          color: #ffffff;
          border-radius: 0.1rem;
        }
        .btnCancel {
          width: 1.6rem;
          height: 0.4rem;
          font-size: 0.16rem;
          background: #ffffff;
          color: #333333;
          border-radius: 0.1rem;
        }
      }
    }
  }

  .backindex {
    width: inherit;
    height: 3rem !important;
    .successImg {
      width: 0.66rem;
      height: 0.67rem;
      position: relative;
      background-image: url(../../../assets/img/education_manage/right.png);
      background-size: 0.66rem 0.67rem;     
      margin: 0.5rem auto;
      top:0.5rem;
      /*float: left;
      margin-left: 1.67rem;
      margin-top: 0.6rem;*/
    }
    .success {
      height: 0.5rem;
      width: 100%;
      text-align: center;
      line-height: 0.5rem;
      font-size: 0.3rem;
      float: left;
    }
    .btn {
      height: 0.5rem;
      width: 100%;
      text-align: center;
      line-height: 0.5rem;
      font-size: 0.3rem;
      float: left;
      margin-top: 0.2rem;
      .btnOk {
        width: 1.6rem;
        height: 0.4rem;
        font-size: 0.16rem;
        background: #3885f8;
        color: #ffffff;
        border-radius: 0.1rem;
      }
      .btnOk:hover {
        background: rgba(56, 133, 248, 0.8);
      }
      .btnCancel {
        width: 1.6rem;
        height: 0.4rem;
        font-size: 0.16rem;
        background: #ffffff;
        border-radius: 0.1rem;
        color: #333333;
        border: 0.01rem solid #c0c4cc;
      }
      .btnCancel:hover {
        background: rgba(56, 133, 248, 0.1);
      }
    }
  }
  /**自定义对话框标题样式**/
  .panel_title {
    padding: 0.23rem 0.31rem 0.23rem 0.31rem;
    font-size: 0.22rem;
    font-family: "microsoft yahei";
    color: #333333;
  }
  /**
		 * 自定义对话框样式
		 */
  .el-dialog-bg {
    background: #ffffff;
    width: 10rem !important;
    border-radius: 0.1rem;
    .el-dialog__header {
      padding: 0px;
    }
    .el-dialog__body {
      padding: 0px !important;
    }
    .el-dialog__footer {
      padding: 0.3rem;
      .footer-btn {
        width: 100%;
        text-align: center;
      }
    }
  }
  .el-dialog-bg2 {
    background: #ffffff;
    width: 4rem;
    border-radius: 0.1rem;
    .el-dialog__header {
      padding: 0px;
    }
    .el-dialog__body {
      padding: 0px !important;
    }
    .el-dialog__footer {
      padding: 0.3rem;
      .footer-btn {
        width: 100%;
        text-align: center;
      }
    }
  }
}
</style>